import java.io.IOException;

/**
 * 测试Runnable类实现的多线程程序
 * 
 * @author leizhimin 2008-9-13 18:15:02
 */
public class TestRunnable {
	
	public static void main(String[] args) throws InterruptedException, IOException {
		DoSomething ds1 = new DoSomething("阿三");
		DoSomething ds2 = new DoSomething("李四");
		
		
		Thread t1 = new Thread(ds1);
//		Thread t2 = new Thread(ds2);

		t1.start();
		
		System.out.println(ds1.getStr());
//		t2.start();
		
			Example thread = new Example();
			System.out.println("Starting thread...");
			thread.start();
			Thread.sleep(3000);
			System.out.println("Asking thread to stop...");
			thread.stop = true;
			Thread.sleep(3000);
			thread.socket.close(); 
			System.out.println("Stopping application...");
			// System.exit( 0 );
	}
}